package com.entrogy.dao;

import com.entrogy.bean.PositionEntity;
import com.entrogy.bean.TeacherBasicInfoEntity;
import net.sf.json.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName PositionMapper
 * @Description
 * @Author luoxingjiang
 * @Date 2019/9/20 0020 下午 5:21
 * @Version 1.0
 **/
@Repository
public interface PositionMapper {

    /**
     * 根据固定的职位id查询自增id
     * @param staticPositionId
     * @param schoolCode
     * @return
     */
    Integer getIdByStaticPositionId(@Param("staticPositionId") Integer staticPositionId, @Param("schoolCode") Integer schoolCode);

    /**
     * 删除教师的多职位信息
     *
     * @param teacherId
     * @return
     */
    int deleteUserPositionInfos(@Param("teacherId") String teacherId);

    /**
     * 插入教师的多职位信息
     *
     * @param teacherId
     * @param positionList
     * @return
     */
    int InsertUserPositionInfos(@Param("teacherId") String teacherId, @Param("positionList") List<PositionEntity> positionList);

    /**
     * 查询多职位教师为某班班主任
     * @param classId
     * @param schoolCode
     * @return
     */
    TeacherBasicInfoEntity getClassLeader(@Param("classId") Integer classId, @Param("schoolCode") Integer schoolCode);

    /**
     * 查询多职位教师为某年级年级组长
     * @param gradeId
     * @param schoolCode
     * @return
     */
    TeacherBasicInfoEntity getGradeLeader(@Param("gradeId") Integer gradeId, @Param("schoolCode") Integer schoolCode);

    /**
     * 得到教师职位列表
     * @param id
     * @return
     */
    List<PositionEntity> listTeacherPosition(@Param("id") String id);

    /**
     * 得到教师职位列表
     * @param teacherId
     * @param positionId
     * @return
     */
    com.alibaba.fastjson.JSONObject listTeacherPositionByPosition(@Param("teacherId") String teacherId, @Param("positionId") Integer positionId);

    /**
     * 得到职位列表
     *
     * @param schoolCode
     * @param positionIdList
     * @return
     */
    List<PositionEntity> listPosition(@Param("schoolCode") Integer schoolCode, @Param("positionIdList") List<Integer> positionIdList, @Param("positionName") String positionName);

    /**
     * 通过pId得到学校的sid
     * @param schoolCode
     * @param pId
     * @return
     */
    PositionEntity getPositionByPid(@Param("schoolCode") Integer schoolCode, @Param("pId") int pId);
}
